<!-- BEGIN: PAGECONTENT -->
        <script type="text/javascript">
			$(document).ready(function() {
			    //validate signup form on keyup and submit
			    $("#admin_form").validate({
			        rules: {
			            FlashHeight:"number",
			            FlashWidth: "number"
			        },
			        messages: {
			            FlashHeight: "Chiều cao Flash phải là số (tính theo đơn vị px)",
			            FlashWidth: "Chiều rộng Flash phải là số (tính theo đơn vị px)"
			        }
			    });
			    
			    // Initialise FancyBox Modal window:
			    $("a.fancy").fancybox({
			        'titlePosition' : 'inside'
			    });
			    
			    
			    // set file type
			    setFileType();
			    
			    $('#FileLink').blur(function() {
			    	setFileType();
		    	});
			    $('#FlashWidth').blur(function() {
			    	setFileType();
		    	});
			    $('#FlashHeight').blur(function() {
			    	setFileType();
		    	});
			});
		</script>
		<style type="text/css">
		    #admin_form label.error { width: 100%; color:red; margin-top:5px;}
		</style>
        <script type="text/javascript">
            function BrowseServer()
            {
                var finder = new CKFinder();
                finder.basePath = 'images/';
                finder.selectActionFunction = SetFileField;
                finder.popup();
            }
            // This is a sample function which is called when a file is selected in CKFinder.
            function SetFileField( fileUrl )
            {
            	$("#FileLink").val(fileUrl);
            	setFileType();
            }
			
            function setFileType(){
            	var fileLink = $("#FileLink").val();
            	
            	if (fileLink.length > 0){
            		if (fileLink.lastIndexOf(".swf") > 0){
            			var flashWidth = $("#FlashWidth").val();
            			var flashHeight = $("#FlashHeight").val();
            			$('div#over-view').html("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\""+flashWidth+"\" height=\""+flashHeight+"\">"+
							  					  "<param name=\"movie\" value=\""+fileLink +"\" />"+
							  					  "<param name=\"quality\" value=\"high\" />"+
							  					  "<param name=\"allowScriptAccess\" value=\"always\" />"+
							  					  "<param name=\"wmode\" value=\"transparent\">"+
							  					     "<embed src=\""+fileLink +"\""+
							  					      "quality=\"high\""+
							  					      "type=\"application/x-shockwave-flash\""+
							  					      "WMODE=\"transparent\""+
							  					      "width=\""+flashWidth+"\""+
							  					      "height=\""+flashHeight+"\""+
							  					      "pluginspage=\"http://www.macromedia.com/go/getflashplayer\""+
							  					      "allowScriptAccess=\"always\" />"+
							  					"</object>");
            			$("#FileType").val('Flash');
            			$("#image-infor").hide();
            			$("#flash-infor").show();
            		} else {
            			$('div#over-view').html("<a href=\""+fileLink +"\" class=\"fancy\" rel=\"group\" id=\"upload-img-fancy\"><img src=\""+fileLink +"\" id=\"upload-img\" style=\"max-height: 250px;\"></a>");
            			$("#FileType").val('Image');
            			$("#flash-infor").hide();
            			$("#image-infor").show();
            			// Initialise FancyBox Modal window:
        			    $("a.fancy").fancybox({
        			        'titlePosition' : 'inside'
        			    });
            		}
            	} else {
            		$("#image-infor").hide();
                	$("#flash-infor").hide();
                	$('div#over-view').html("");
            	}
            }
        </script>
        <div class="form-content-page">
            <section>
			        <form class="block-content form" id="admin_form" method="post" action="submit.php?ctrl={CONTROLLER}&act={ACTION}">
			            <h2>{FORMTITLE}</h2>
			            <!-- BEGIN: FORMITEM -->
			            	<input type="hidden" name="ID" id="ID" value="{FORMITEM.ID}">
			                <input type="hidden" name="Type" id="Type" value="{FORMITEM.Type}">
			                <input type="hidden" name="FileType" id="FileType" value="{FORMITEM.FileType}">
			            <fieldset>
			                <legend>
			                    Thông tin hiển thị popup
			                </legend>
		                 	<p>
			                    <label for="simple-required">Tiêu đề popup:</label>
			                    <input type="text" name="Title" id="Title" value="{FORMITEM.Title}" class="full-width">
			                </p>
			                <p>
			                    <label for="simple-required">Đường dẫn website:</label>
			                    <input type="text" name="Link" id="Link" value="{FORMITEM.Link}" class="full-width">
			                </p>
			                <p>
                                <label for="simple-calendar">Chọn file hiển thị (ảnh/flash):</label>
                                    <input type="text" name="FileLink" id="FileLink" value="{FORMITEM.FileLink}" class="half-width" />
                                    &nbsp;&nbsp;<button type="button" class="grey browser-file" onclick="BrowseServer();">Select image</button>
                            </p>
                            <div style="width: 100%" align="center" id="over-view">
                           		
                        	</div>
			            </fieldset>
			            <fieldset id="image-infor">
			                <legend>
			                    Thông tin ảnh hiển thị
			                </legend>
			                <p>
			                    <label for="simple-required">Thuôc tính title của thẻ img:</label>
			                    <input type="text" name="ImageTitle" id="ImageTitle" value="{FORMITEM.ImageTitle}" class="full-width">
			                </p>
			                <p>
			                    <label for="simple-required">Thuôc tính alt của thẻ img:</label>
			                    <input type="text" name="ImageAlt" id="ImageAlt" value="{FORMITEM.ImageAlt}" class="full-width">
			                </p>
			            </fieldset>
			            <fieldset id="flash-infor">
			                <legend>
			                    Thông tin flash hiển thị
			                </legend>
			                <p>
			                    <label for="simple-required">Chiều rộng flash (px):</label>
			                    <input type="text" name="FlashWidth" id="FlashWidth" value="{FORMITEM.FlashWidth}" class="full-width">
			                </p>
			                <p>
			                    <label for="simple-required">Chiều cao flash (px):</label>
			                    <input type="text" name="FlashHeight" id="FlashHeight" value="{FORMITEM.FlashHeight}" class="full-width">
			                </p>
			            </fieldset>
			            <fieldset class="grey-bg no-margin">
			                <p class="input-with-button" align="center">
			                    <button type="submit">
			                        hoàn thành
			                    </button>
			                    <a href="maincontent.php?ctrl={CONTROLLER}&act=view-popup">
				                    <button type="button">
		                                hủy bỏ
		                            </button> 
	                            </a>
			                </p>
			            </fieldset>
			            <!-- BEGIN: FORMITEM -->
			        </form>
			</section>
        </div>
<!-- END: PAGECONTENT -->